<?php

session_start();
//验证是否有这个用户
//验证密码是否正确

$username = $_POST['Username'];
$password = $_POST['password'];

$sql = 'select * from `count` where `userid` =\''.str_replace("''",'',$username).'\'';
$sqli = new mysqli("localhost","root","","mybolg");
$rs = $sqli->query($sql);
$row = $rs->fetch_assoc();


if(!$row) echo "用户名未找到<br /><a href='register.html'>点击跳转到注册界面</a>";
else{
    $passwordIndb = $row["password"];
    if($passwordIndb!=$password){
        echo "密码错误<br />";
    }else{
        //密码验证
        //$_SESSION["user"] = $row;//让服务器记住，该用户已经验证过账号密码了
        //setcookie("user",$row["id"]);
        //$_SESSION["user"] = $row;
        echo "登陆成功<br/>";
        echo "<a href='information.php'>点击跳转到信息界面</a>";
    }
}
?>